---
- hosts: starter
  tasks:
  - name: take CA file
    fetch:
      src: /etc/ssl/ca/ca.pem
      state: latest
      dest: /tmp/ca.pem
      flat: true

- hosts: cluster
  tasks:
  - name: Copy CA certificate
    copy:
      src: /tmp/ca.pem
      dest: /etc/pki/ca-trust/source/anchors
    notify:
    - Update ca trust

  - name: Docker certs.d dir
    file:
      path: /etc/containerd/certs.d/starter.kryukov.local
      state: directory
      recurse: yes

  - name: Copy CA certificate
    copy:
      src: "/tmp/ca.pem"
      dest: "/etc/containerd/certs.d/starter.kryukov.local"

  handlers:
  - name: Update ca trust
    command: update-ca-trust




